
include Makefile.rules

PROGRAM = lonvif

SHARED_LIB = libonvif.so
#openssl 
OPENSSL_DIR = ./ssl

#源文件

SOURCES_ONVIF +=    onvif/soapC.c 			    \
                    onvif/soapClient.c 		    \
                    onvif/stdsoap2.c 			\
                    onvif/duration.c 			\
                    onvif/dom.c 			    \
                    onvif/mecevp.c 			    \
                    onvif/smdevp.c 			    \
                    onvif/threads.c 			\
                    onvif/wsseapi.c			    \
                    onvif/wsaapi.c			    \

SOURCES +=          main.c                      \
                    onvif.c                     \
                    dump.c                      \


OBJECT_ONVIF := $(patsubst %.c, %.o, $(filter %.c, $(SOURCES_ONVIF)))
OBJECTS := $(patsubst %.c, %.o, $(filter %.c, $(SOURCES)))

#共享库链接
LDLIBS +=   $(OPENSSL_DIR)/lib/libssl.a	 	    \
            ${OPENSSL_DIR}/lib/libcrypto.a 	    \
            -ldl

LDLIBS += -lpthread


#头文件路径
INCLUDE += -Ionvif  -I$(OPENSSL_DIR)/include 	

# -DWITH_DOM -DWITH_OPENSSL 两个宏是链接openssl
# -DDEBUG 用于开启soap协议收发日志，日志存于文件RECV.log SENT.log TEST.log
CFLAGS += -DWITH_DOM -DWITH_OPENSSL 

all: $(PROGRAM) $(SHARED_LIB)

$(PROGRAM): $(OBJECT_ONVIF) $(OBJECTS) main.o
	$(CC) -o $@ $(OBJECT_ONVIF) $(OBJECTS) $(LDLIBS)

$(SHARED_LIB): $(OBJECT_ONVIF)  $(OBJECTS)
	$(CC) -shared -o $@ $(OBJECT_ONVIF) $(OBJECTS) $(LDLIBS)

clean:
	rm -f $(OBJECTS) $(OBJECT_ONVIF)
	rm -f $(PROGRAM)
	rm -f $(SHARED_LIB)
